import com.alibaba.druid.sql.dialect.odps.ast.OdpsAddFileStatement;
import com.chai.config.SpringConfig;
import com.chai.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;

/**
 * 纯注解开发模式
 */
public class AppForAnnotation {
    public static void main(String[] args) {
        ApplicationContext apc = new AnnotationConfigApplicationContext(SpringConfig.class);
//        BookService bookService = (BookService) apc.getBean("bookService");
//        bookService.execute();
        /**
         * 获取第三方bean
         * 1.创建管理第三方bean的Java文件（JdbcConfig.java），添加@Bean
         * 2.在SpringConfig中添加@Import进行文件的注入
         * */
        DataSource dataSource = (DataSource) apc.getBean("dataSource");
        System.out.println(dataSource);
    }
}
